#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10,M=13;
int n,ans=1e9,a[N],b[N];
int Mn[M],Mx[M];
inline void Max(int &x,int y) {x=x>y?x:y;}
inline void Min(int &x,int y) {x=x>y?y:x;}
void check()
{
    int res=0;
    for(int i=1;i<=n;i++) res+=(a[i]!=b[i]);
    Min(ans,res);
}
void dfs(int x,int l,int r)
{
    if(x>n) return check();
    b[l]=x,dfs(x+1,l+1,r);
    b[r]=x,dfs(x+1,l,r-1);
}
int main()
{
    freopen("build.in","r",stdin);
    freopen("build.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    dfs(1,1,n);
    printf("%d\n",ans);
    return 0;
}